Python: Include InvokeAzureAgent input.arguments in agent text - #7907
Python: Include InvokeAzureAgent input.arguments in agent text#7907Shivani . (Shivani767) wants to merge 1 commit into
Conversation
Fold evaluated input.arguments into the text passed to agent.run() so argument-only InvokeAzureAgent actions no longer silently invoke with an empty string.
There was a problem hiding this comment.
Pull request overview
Fixes #7902 by preserving evaluated InvokeAzureAgent arguments in agent input text.
Changes:
- Formats arguments as
key: valuelines. - Combines arguments with explicit or fallback message text.
- Adds regression coverage for argument-only, combined, and expression-based inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py |
Includes evaluated arguments in agent input text. |
python/packages/declarative/tests/test_graph_coverage.py |
Adds regression tests for argument handling. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
/review |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 88e4989182d7
Model: gpt-5.6-sol
Overview
The change correctly recovers previously discarded input.arguments, evaluates expressions before formatting, and preserves the existing messages-only behavior when the argument map is empty. The new tests cover arguments alone on a clean state, arguments with explicit messages, and expression-valued arguments. However, arguments-only actions still execute the implicit-input fallback chain, so chained workflows append a prior agent response or workflow input to the explicit argument block.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py
| messages_text = str(getattr(last, "text", "")) # type: ignore | ||
| elif evaluated_input: | ||
| messages_text = str(cast(Any, evaluated_input)) | ||
| else: |
There was a problem hiding this comment.
When an action supplies input.arguments but omits input.messages, this branch still reads the implicit fallback chain and line 741 appends it to the argument block. In a chained workflow, every completed agent sets System.LastMessage, so arguments-only actions such as the customer-support TicketingAgent receive both their structured fields and the prior agent's response; first-agent actions can similarly duplicate values from Workflow.Inputs. Please skip the implicit fallback when explicit arguments are present, while retaining it for actions with neither arguments nor messages.
Motivation & Context
InvokeAzureAgentExecutor._build_input_text()evaluatedinput.argumentsintoevaluated_argsand then never used that dict. Actions that supply onlyinput.arguments(as in the customer_support sample) therefore invoked the agent with an empty string.Fixes #7902
Description & Review Guide
What are the major changes?
input.argumentsaskey: valuelines (same shape as multi-valueWorkflow.Inputsfallback).What is the impact of these changes?
InvokeAzureAgentactions now pass structured values toagent.run().What do you want reviewers to focus on?
structured_inputschannel (.NETuses the latter; Pythonrun()has no equivalent parameter).Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.